<template>
	<view class="success">
		<view class="u-content">
			<view class="u-content__circle">
				<u-icon name="checkmark-circle-fill" color="#47578E" size="60"></u-icon>
			</view>
		</view>
		<view class="title">
			{{title}}
		</view>
		<view class="btn-succss">
			<u-button class="custom-style" shape="circle" text="返回首页" customStyle="background-color: #00C777;color:#fff"
				@click="goBack">
			</u-button>
		</view>
	</view>
	</view>
</template>

<script>
	import {
		bindWechat
	} from '@/request/api.js'
	export default {
		data() {
			return {
				title: '',
				form:{
					wxCode:''
				}
			}
		},
		methods: {
			goBack() {
				uni.switchTab({
					url:'/pages/message/index'
				})
			},
			async bindWechat(){
				let res = await bindWechat(this.form)
				this.goBack()
			}
		},
		onLoad(res) {
			console.log(res)
			this.form.wxCode =  res.code
			this.title = '登录授权已完成！'
			this.bindWechat()
		}
	}
</script>

<style lang="scss" scoped>
	.success {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		.u-content {
			margin-top: 180rpx;
		}

		.title {
			margin-top: 90rpx;
		}

		.btn-succss {
			margin-top: 120rpx;
			width: 50%;
		}
	}
</style>
